package com.example.hssmgs.Student;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.hssmgs.R;

public class Student_login extends Activity {

    private Button new_info;
    private Button show_info;
    private Button left_msg;
    private Button back_main;
    private SQLiteDatabase db; // 数据库对象
    private TextView test_show;
    private String account;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.student_login);

        initView();
        Intent intent= getIntent();
        account = intent.getStringExtra("student_id");


        // 修改信息事件
        new_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent= getIntent();
                intent.setClass(Student_login.this, new_info.class);
                intent.putExtra("student_id", account);
                startActivity(intent);
            }
        });

        // 显示信息事件
        show_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(Student_login.this, show_info.class);
                intent.putExtra("student_id", account);
                startActivity(intent);
            }
        });

        // 显示留言事件
        left_msg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(Student_login.this, left_msg.class);
                intent.putExtra("student_id", account);
                startActivity(intent);
            }
        });

        // 返回事件
        back_main.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    private void initView() {
        new_info = findViewById(R.id.new_info);
        show_info = findViewById(R.id.show_info);
        left_msg = findViewById(R.id.left_msg);
        back_main = findViewById(R.id.back_Main_1);
    }
}